/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rentcar.datasender.services;

import com.google.gson.Gson;
import java.util.Date;
import rentcar.datasender.models.CarPosData;
import rentcar.datasender.models.CarPosInfo;
import rentcar.datasender.models.CmdResultInfo;
import rentcar.datasender.models.TelematicsResult;

/**
 *
 * @author wuhao
 */
public class DataGenerator {

        public String GetMsg() {
                /*
        {
    "systemno": "xxx",//车辆标识
    "identifying": "E02",//固定
    "data": {
        "time": "2014-06-12 09:47:05",
        "latitude": "30.46262",
        "longitude": "114.4243",
        "speed": "0",//速度，除以10之后单位是 km/h
        "direction": "0",//方向角
        "islocation": "0"//信号是否正常，0为正常，1为不正常
    }
}
                 */
                CarPosData cpd = new CarPosData();
                cpd.setDirection(0);
                cpd.setIslocation(0);
                cpd.setSpeed(1000);
                cpd.setLon(114.4243*1e6);
                cpd.setLat(30.46262*1e6);
                cpd.setTime(new Date());

                CarPosInfo cpi = new CarPosInfo();
                cpi.setData(cpd);
                cpi.setIdentifying("E02");
                cpi.setSystemno("12345678901234567");

                Gson gson = new Gson();
                String jsonInString = gson.toJson(cpi);

                return jsonInString;
        }
}
